////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                            //
//                                                         WNProject                                                          //
//                                                                                                                            //
//            This file is distributed under the BSD 2-Clause open source license. See License.txt for details.               //
//                                                                                                                            //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#ifndef __WN_CONTAINERS_DATA_BUFFER_H__
#define __WN_CONTAINERS_DATA_BUFFER_H__

#include "WNCore/inc/WNTypes.h"

namespace WNContainers {
    class WNSerializerBase;

    enum WNDataBufferType {
        ReadBinary,
        WriteBinary,
        ReadText,
        WriteText
    };

    enum WNDataBufferFlags {

    };

    //Notes! The data buffer does not do any checking for data integrity
    // it is entirely designed to move data from point A to point B
    class WNDataBuffer {
    public:
        virtual WN_BOOL Serialize(WN_UINT32 _flags, const WNSerializerBase& _serializer) = 0;
        //Reserve Bytes will ensure that there are at least _numBytes available for writing on a write buffer
        //Reserve Bytes will try to ensure that there are _numBytes to read on a read buffer, but if the end of file/stream
        //    is reached first, you can hit bad data. It is best to make sure you do not try and read more data than there is
        virtual WN_CHAR* ReserveBytes(WN_SIZE_T _numBytes, WN_SIZE_T& _returnedBytes) = 0;
        virtual WNDataBufferType GetType() = 0;

    public:
        static const WN_SIZE_T mMaxWNDataBufferWrite = 1024;
    };
}

#endif // __WN_CONTAINERS_DATA_BUFFER_H__
